/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.reporte.utils;

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;

/**
 *
 * @author 43548913
 */
public class EncriptadorED {
    
    private static String llave = JsfAyuda.getPropertyValueFromConfigurationFile("moduloSemilla");

    public EncriptadorED() {
    }

   
     public static String getEncriptar(String valor) {
        StandardPBEStringEncryptor crypt=new StandardPBEStringEncryptor();
        crypt.setPassword(llave);
        String cadenaEncriptada=crypt.encrypt(valor);
        return cadenaEncriptada;
    }
    
    public static String getDesencriptar(String valor) {
        try{
        StandardPBEStringEncryptor crypt=new StandardPBEStringEncryptor();
        crypt.setPassword(llave);
        String cadenaEncriptada=crypt.decrypt(valor);
        return cadenaEncriptada;
    }catch(Exception e){
            System.out.println("ERROR: "+e.getMessage());
            return null;
        }
    }
}
